#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int x,y,a,b;
		cin>>x>>y>>a>>b;
		int ans = abs(y-x);
		if(ans%(a+b)==0) cout<<ans/(a+b)<<endl;
		else cout<<"-1"<<endl;
	}
}
